<template>
  <div class="containers">
    <div class="container">
      <div class="form-box" style="width: 100%; max-width: 1200px">
        <el-descriptions class="margin-top" title="奖励设置" :column="3"  border>
          <template slot="extra">
            <el-button type="primary" size="mini" @click="setlv()">保存</el-button>
          </template>
          <el-descriptions-item>
            <template slot="label">
              结算平均天数(天)
            </template>
            <el-input   v-model="form.settlement" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              进入底池比例(%)
            </template>
            <el-input v-model="form.pot"  ></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              进入市值比例(%)
            </template>
            <el-input v-model="form.market"  ></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              平台利润(%)
            </template>
            <el-input v-model="form.platform" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              直推奖励(%)
            </template>
            <el-input v-model="form.share" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              释放比例(%)
            </template>
            <el-input v-model="form.release" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              市值管理释放比例(%)
            </template>
            <el-input v-model="form.market_management" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              会员折扣(%)
            </template>
            <el-input v-model="form.discount" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              权重系数(%)
            </template>
            <el-input v-model="form.weight" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              1星馆长(%)
            </template>
            <el-input v-model="form.agent1" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              2星馆长(%)
            </template>
            <el-input v-model="form.agent2" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              3星馆长(%)
            </template>
            <el-input v-model="form.agent3" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              v1(%)
            </template>
            <el-input v-model="form.v1" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              v2(%)
            </template>
            <el-input v-model="form.v2" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              v3(%)
            </template>
            <el-input v-model="form.v3" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              v4(%)
            </template>
            <el-input v-model="form.v4" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              v5(%)
            </template>
            <el-input v-model="form.v5" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              v6(%)
            </template>
            <el-input v-model="form.v6" type="number"></el-input>
          </el-descriptions-item>

          <el-descriptions-item>
            <template slot="label">
              v7(%)
            </template>
            <el-input v-model="form.v7" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              v8(%)
            </template>
            <el-input v-model="form.v8" type="number"></el-input>
          </el-descriptions-item>
          <el-descriptions-item>
          </el-descriptions-item>




        </el-descriptions>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      code: 0,
      form: {
        settlement:0,//结算平均天数
        pot:0,//进入底池比例
        market:0,//进入市值比例
        platform:0,//平台利润
        share:0,//直推奖励
        release:0,//释放比例
        market_management:0,//市值管理释放比例
        discount:0,//会员区折扣
        weight:0,//权重系数
        v1:0,
        v2:0,
        v3:0,
        v4:0,
        v5:0,
        v6:0,
        v7:0,
        v8:0,
        agent1: 0,//一星馆长
        agent2: 0,
        agent3: 0,


      },
    };
  },
  created() {
    this.load(); //获取
  },
  methods: {
    changeCode(e) {
      this.load(); //获取
    },
    load() {
      this.request("admin/rewardSet/", "get", {}, "demo").then(
        (res) => {
          if (res.errno == 0) {
            this.form = res.data;
            console.log(this.form)
          }
        },
        function () {
          console.log("请求失败处理");
        }
      );
    },
    setlv() {

      this.$confirm("是否确认保存?", "提示", {
        type: "warning",
      }).then(() => {

        for (const field in this.form) {
          this.form[field] = Number(this.form[field]);

        }

        this.request("admin/rewardSet/", "post", this.form, ).then(
          (res) => {
            this.$message.success(res.errmsg);
          },
          function () {
            console.log("请求失败处理");
          }
        );
      });
    },
  },
};
</script>
<style scoped="scoped">
.container {
  padding: 20px;
}

.activeattr {
  border: 1px solid rgb(64, 158, 255);
  color: rgb(64, 158, 255);
}

.el-upload {
  width: 100px !important;
  height: 100px !important;
}
</style>
